package com.Springdemo.controller;

import com.Springdemo.enity.Fruit;
import com.Springdemo.service.FruitService;
import com.Springdemo.service.Impl.FruitServiceImpl;
import com.Springdemo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: lool
 * @Date: 2022-06-10 20:09
 * @Description:   1.查询所有水果
 */
@Controller
@RequestMapping("fruit")
public class FruitController {

    @Autowired
    private FruitService fruitService;

    @GetMapping(value = "all")
    @ResponseBody
    public List<Fruit> findAllFruit(HttpServletResponse response){
        System.out.println("所有水果显示成功");
        List<Fruit> list= new ArrayList<Fruit>();
        list=  fruitService.findAllFruit();
        System.out.println("list"+list);
        return list;

    }
}
